home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 49
/
Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso
/
-serious-
/
misc
/
football
/
user
/
referees.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-11-29
|
4KB
|
176 lines
/* Mode=Run */
/* ***********************************************************************
REFEREES PROGRAM FOR FOOTBALL REXX SUITE
------------------------------------------
Copyright Mark Naughton 1999
Version Date History
--------------------------------------------------------------------------
1.0 170699 First release.
250899 Added error msg to file check.
280899 Converted to use locale. Some error messages, before
reading the locale, will still be in English.
**************************************************************************
Procedure
---------
1. Check file exists.
2. Open '.sflearn' file and read in referees, storing them and if the name
appears more than once, increment the number of matches played.
3. Write referees out to temp file and sort.
4. Display table.
5. Read temp file and display referees with total matches. Exit.
************************************************************************** */
PARSE ARG league_stuff
version = 1
input_file = '.sflearn'
refs = '*RF='
rfnm = '**'
separator = '*'
teams. = '???'
wins. = '???'
lines. = '???'
counter = 0
league_file = "Data/" || league_stuff
if open(datafile,"Data/Football.locale",'r') then do
line = readln(datafile)
locdir = strip(line)
close(datafile)
end
else do
say
say "ERROR : (Referees)"
say
say "Cannot read 'Data/Football.locale' for the locale settings."
exit
end
locdir = locdir"User/Referees.data"
if open(datafile,"ENV:FootballRXPath",'r') then do
line = readln(datafile)
rxdir = strip(line)
close(datafile)
end
else
rxdir = "SYS:Rexxc/"
if exists(locdir) > 0 then do
address command rxdir'rx 'locdir
VarCount = getclip('VarCount')
do i = 1 to VarCount
interpret getclip('var.'i)
end
end
else do
say
say "ERROR : (Referees)"
say
say "Cannot find '"locdir"' to read locale settings."
exit
end
if exists(league_file || input_file) = 0 then do
say
say rf_error
say
say rf_one"'"league_file || input_file"'."
exit
end
if open(datafile,league_file || input_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(rfnm,line) > 0 then
lname = delstr(line,1,3)
if pos(refs,line) > 0 then do
name = delstr(line,1,4)
notin = 0
do i=1 to counter
if pos(name,teams.i) > 0 then do
wins.i = wins.i + 1
notin = 1
end
end
if notin = 0 then do
counter = counter + 1
teams.counter = name
wins.counter = 1
end
end
end
close(datafile)
end
else do
say
say rf_error
say
say rf_two"'"league_file||input_file"'"rf_three
exit
end
if counter > 1 then do
if open(datafile,"RAM:Football.tempcup",'w') then do
do i=1 to counter
writeln(datafile,left(wins.i,4)" "teams.i)
end
close(datafile)
end
else do
say
say rf_error
say
say rf_four
exit
end
address command 'Exec/Sort4Chars '
end
say
say center(rf_txt1"'"lname"'",78)
say "-------------------------------------------------------------------------------"
say
say
say rf_txt2
say "-------------------------------------------------------------------------------"
say
i = 0
if counter = 1 then do
say left(wins.1,4)" "teams.1
say
end
else do
if open(datafile,"RAM:Football.tempcup",'r') then do
do while ~eof(datafile)
line = readln(datafile)
if i = 0 then do
say upper(line)
i = 1
end
else
say line
end
close(datafile)
end
else do
say
say rf_error
say
say rf_txt3
exit
end
address command 'delete >NIL: RAM:Football.tempcup'
end
say "-------------------------------------------------------------------------------"
exit